package com.example.tys.daggermvp.mvp.view;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.example.tys.daggermvp.BaseFragment;
import com.example.tys.daggermvp.R;
import com.example.tys.daggermvp.dagger2.annotation.ActivityScoped;
import com.example.tys.daggermvp.mvp.contract.PlusOneFragmentContract;
import com.example.tys.daggermvp.mvp.module.PlusOneFragmentData;

import javax.inject.Inject;

/**
 * @author tys
 */
@ActivityScoped
public class PlusOneFragment extends BaseFragment<PlusOneFragmentContract.Presenter, PlusOneFragmentContract.View, PlusOneFragmentContract.Data>
        implements PlusOneFragmentContract.View {

    @Inject
    public PlusOneFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_plus_one, container, false);
        view.findViewById(R.id.plus_one_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mPresenter.fragment();
            }
        });
        return view;
    }

    @Override
    public void fragment(String str) {
        Toast.makeText(getContext(), "fragment:" + str, Toast.LENGTH_SHORT).show();
    }
}
